package chen.web.firewall;

import javax.servlet.Filter;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import chen.web.MyContext;
import chen.web.MyContextProvider;
import chen.web.user.Account;

public class AccountFilter extends AbstractFilter<AccountTable> implements Filter {

	private static Log log = LogFactory.getLog(AccountFilter.class);

	
	@Override
	protected boolean accept(HttpServletRequest request) {
		// TODO Auto-generated method stub
		MyContext context = MyContextProvider.getMyContext();
		Account account = context.getAccount();
		boolean accept = super.getTable().accept(account);
		if(!accept && log.isDebugEnabled()){
			log.debug("帐号禁止访问：" + account.toString());
		}
		return accept;
	}

}
